public class Demo12 {
    public static void main(String[] args) throws InterruptedException {
        Object o1 = new Object();
        Object o2 = new Object();

        Thread thread1 = new Thread(() -> {
           synchronized (o1) {
               synchronized (o2) {
                   while(true ) {
                       System.out.println(1);
                   }
               }
           }
        });
        thread1.start();
        thread1.join();

    }
     private void fun () {

    }
}
